#ifndef FILE_DIR_LIST_H
#define FILE_DIR_LIST_H

#include <QWidget>
#include <QTableWidget>
#include "picture.h"

#define FILE_DIR_PATH_SIZE 512
#define FILE_DIR_NAME_SIZE 48

struct file_dir_info
{
    char path[FILE_DIR_PATH_SIZE];
    char name[FILE_DIR_NAME_SIZE];
    unsigned long  adder;
    unsigned long  size;
    unsigned long crc;
    int w;
    int h;
};

class FileDirList : public QWidget
{
    Q_OBJECT

public: FileDirList(void);
    ~FileDirList();
    void set(QWidget *parent, int x, int y);
    void reset(void);
    void set_path(QString path);
    void set_offset(unsigned short offset);
    unsigned short get_offset(void);
    int get_count(void);
    const file_dir_info *get_index(int index);

signals:
    void show_signal(int);
    void updata(int);

private slots:
    void show_slost(int);

private:
    int file_add(QString path, QString file);
    int get_file_size(QString path, QString file);
    unsigned long  file_crc(QString path, QString file);
    QTableWidget tab;
    picture pic;
    file_dir_info *pinfo;
    int file_offset;
    int info_cnt;
    int info_tal;
    unsigned short add_offset;
    bool pic_ok;
};
#endif // FILE_DIR_LIST_H
